use actix_web::{HttpResponse};
use crate::{
    common::{Response, Pool},
    apps::backend::models::City as Model,
};

/// 城市信息
pub struct Cities;

impl Cities {

    /// 列表页
    pub async fn index(db: Pool) -> HttpResponse {
        match Model::list(&db).await {
            Ok(v) => { Response::encrypt_data(&v) },
            Err(message) => { Response::error(&message.to_string()) }
        }
    }
}
